<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.5"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>FreeRTOS Addons: cpp_freertos::Thread Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">FreeRTOS Addons
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.5 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacecpp__freertos.html">cpp_freertos</a></li><li class="navelem"><a class="el" href="classcpp__freertos_1_1_thread.html">Thread</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="#friends">Friends</a> &#124;
<a href="classcpp__freertos_1_1_thread-members.html">List of all members</a>  </div>
  <div class="headertitle"><div class="title">cpp_freertos::Thread Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div></div>
</div><!--header-->
<div class="contents">

<p><code>#include &lt;<a class="el" href="thread_8hpp_source.html">thread.hpp</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for cpp_freertos::Thread:</div>
<div class="dyncontent">
 <div class="center">
  <img src="classcpp__freertos_1_1_thread.png" usemap="#cpp_5Ffreertos::Thread_map" alt=""/>
  <map id="cpp_5Ffreertos::Thread_map" name="cpp_5Ffreertos::Thread_map">
<area href="classcpp__freertos_1_1_task.html" title="A Thread which has the Run method implemented as loop which is executing the function that is passed ..." alt="cpp_freertos::Task" shape="rect" coords="0,56,130,80"/>
  </map>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a15a295c17b0ebc4a05f92bd93deb6cbd"><td class="memItemLeft" align="right" valign="top"><a id="a15a295c17b0ebc4a05f92bd93deb6cbd" name="a15a295c17b0ebc4a05f92bd93deb6cbd"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>Thread</b> (const char *Name, uint16_t StackDepth, UBaseType_t Priority)</td></tr>
<tr class="separator:a15a295c17b0ebc4a05f92bd93deb6cbd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab9bcc1da7274a7337ce35ee75916cee2"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_thread.html#ab9bcc1da7274a7337ce35ee75916cee2">Thread</a> (const std::string Name, uint16_t StackDepth, UBaseType_t Priority)</td></tr>
<tr class="separator:ab9bcc1da7274a7337ce35ee75916cee2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a12f645310d73fb7fb31dfc4e0b971e1b"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_thread.html#a12f645310d73fb7fb31dfc4e0b971e1b">Thread</a> (uint16_t StackDepth, UBaseType_t Priority)</td></tr>
<tr class="separator:a12f645310d73fb7fb31dfc4e0b971e1b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a37d9edd3a1a776cbc27dedff949c9726"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_thread.html#a37d9edd3a1a776cbc27dedff949c9726">~Thread</a> ()</td></tr>
<tr class="separator:a37d9edd3a1a776cbc27dedff949c9726"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1053a1c4f291a9a9a5dbf4ead7e96ae7"><td class="memItemLeft" align="right" valign="top">TaskHandle_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_thread.html#a1053a1c4f291a9a9a5dbf4ead7e96ae7">GetHandle</a> ()</td></tr>
<tr class="separator:a1053a1c4f291a9a9a5dbf4ead7e96ae7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a51469110641ad7ba19a32364dd18c213"><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_thread.html#a51469110641ad7ba19a32364dd18c213">GetName</a> ()</td></tr>
<tr class="separator:a51469110641ad7ba19a32364dd18c213"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a30aa504f62ae8e05ec652e654b208ab8"><td class="memItemLeft" align="right" valign="top"><a id="a30aa504f62ae8e05ec652e654b208ab8" name="a30aa504f62ae8e05ec652e654b208ab8"></a>
char *&#160;</td><td class="memItemRight" valign="bottom"><b>GetName</b> ()</td></tr>
<tr class="separator:a30aa504f62ae8e05ec652e654b208ab8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ace92214a082dd8fd49e48af680e9bee5"><td class="memItemLeft" align="right" valign="top">UBaseType_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_thread.html#ace92214a082dd8fd49e48af680e9bee5">GetPriority</a> ()</td></tr>
<tr class="separator:ace92214a082dd8fd49e48af680e9bee5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a00923e979ba8b757d293c7f33701df29"><td class="memItemLeft" align="right" valign="top">UBaseType_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_thread.html#a00923e979ba8b757d293c7f33701df29">GetPriorityFromISR</a> ()</td></tr>
<tr class="separator:a00923e979ba8b757d293c7f33701df29"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0a413b18b2818072998320f1f6388eee"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_thread.html#a0a413b18b2818072998320f1f6388eee">Resume</a> ()</td></tr>
<tr class="separator:a0a413b18b2818072998320f1f6388eee"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa11e945ef24eb35b4df261050576a2c0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_thread.html#aa11e945ef24eb35b4df261050576a2c0">ResumeFromISR</a> ()</td></tr>
<tr class="separator:aa11e945ef24eb35b4df261050576a2c0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5e40076f0050bdcfcf949506f139879e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_thread.html#a5e40076f0050bdcfcf949506f139879e">SetPriority</a> (UBaseType_t NewPriority)</td></tr>
<tr class="separator:a5e40076f0050bdcfcf949506f139879e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a279c2b78aa2bf43371f2462623588830"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_thread.html#a279c2b78aa2bf43371f2462623588830">Start</a> ()</td></tr>
<tr class="separator:a279c2b78aa2bf43371f2462623588830"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad316472f4b620715ea0afe15f157d88d"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_thread.html#ad316472f4b620715ea0afe15f157d88d">Start</a> (int core)</td></tr>
<tr class="memdesc:ad316472f4b620715ea0afe15f157d88d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Starts the task on the indicated core.  <a href="classcpp__freertos_1_1_thread.html#ad316472f4b620715ea0afe15f157d88d">More...</a><br /></td></tr>
<tr class="separator:ad316472f4b620715ea0afe15f157d88d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9eca55dec69e4758cf397e882338c7e6"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_thread.html#a9eca55dec69e4758cf397e882338c7e6">Suspend</a> ()</td></tr>
<tr class="separator:a9eca55dec69e4758cf397e882338c7e6"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-static-methods" name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:ae594e304335470c5dec7933643e66418"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_thread.html#ae594e304335470c5dec7933643e66418">EndScheduler</a> ()</td></tr>
<tr class="separator:ae594e304335470c5dec7933643e66418"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6c5e2fea2e1badb606730c279559aa36"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_thread.html#a6c5e2fea2e1badb606730c279559aa36">StartScheduler</a> ()</td></tr>
<tr class="separator:a6c5e2fea2e1badb606730c279559aa36"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abe20a08801d022da203e0295dbb59cbb"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_thread.html#abe20a08801d022da203e0295dbb59cbb">Yield</a> ()</td></tr>
<tr class="separator:abe20a08801d022da203e0295dbb59cbb"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pro-methods" name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr class="memitem:a997f36c77c28021873241b0df1c21a6b"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_thread.html#a997f36c77c28021873241b0df1c21a6b">Cleanup</a> ()</td></tr>
<tr class="separator:a997f36c77c28021873241b0df1c21a6b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a654a6f8af37d09ede473728dd76acffe"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_thread.html#a654a6f8af37d09ede473728dd76acffe">Delay</a> (const TickType_t Delay)</td></tr>
<tr class="separator:a654a6f8af37d09ede473728dd76acffe"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9fb9580f5d710d6c9b1c4e8a8d23985c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_thread.html#a9fb9580f5d710d6c9b1c4e8a8d23985c">DelayUntil</a> (const TickType_t Period)</td></tr>
<tr class="separator:a9fb9580f5d710d6c9b1c4e8a8d23985c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a71f796ec7c2bd53bb0f28b648967f601"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_thread.html#a71f796ec7c2bd53bb0f28b648967f601">ResetDelayUntil</a> ()</td></tr>
<tr class="separator:a71f796ec7c2bd53bb0f28b648967f601"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a93df31e4bee72f150dd742ab5d6d35c3"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_thread.html#a93df31e4bee72f150dd742ab5d6d35c3">Run</a> ()=0</td></tr>
<tr class="separator:a93df31e4bee72f150dd742ab5d6d35c3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a91a73909fb17ee160f992a78cfd2b119"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_thread.html#a91a73909fb17ee160f992a78cfd2b119">Wait</a> (<a class="el" href="classcpp__freertos_1_1_condition_variable.html">ConditionVariable</a> &amp;Cv, <a class="el" href="classcpp__freertos_1_1_mutex.html">Mutex</a> &amp;CvLock, TickType_t Timeout=portMAX_DELAY)</td></tr>
<tr class="separator:a91a73909fb17ee160f992a78cfd2b119"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="friends" name="friends"></a>
Friends</h2></td></tr>
<tr class="memitem:ab270e49e575fdf0fe1a4f2ee911df116"><td class="memItemLeft" align="right" valign="top">class&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_thread.html#ab270e49e575fdf0fe1a4f2ee911df116">ConditionVariable</a></td></tr>
<tr class="separator:ab270e49e575fdf0fe1a4f2ee911df116"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p >Wrapper class around FreeRTOS's implementation of a task.</p>
<p >This is an abstract base class. To use this, you need to subclass it. All of your threads should be derived from the <a class="el" href="classcpp__freertos_1_1_thread.html">Thread</a> class. Then implement the virtual Run function. This is a similar design to Java threading.</p>
<p >By default, we leverage C++ strings for the <a class="el" href="classcpp__freertos_1_1_thread.html">Thread</a> Name. If this is not desirable, define CPP_FREERTOS_NO_CPP_STRINGS and the class will fall back to C character arrays. </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="ab9bcc1da7274a7337ce35ee75916cee2" name="ab9bcc1da7274a7337ce35ee75916cee2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab9bcc1da7274a7337ce35ee75916cee2">&#9670;&#160;</a></span>Thread() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Thread::Thread </td>
          <td>(</td>
          <td class="paramtype">const std::string&#160;</td>
          <td class="paramname"><em>Name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>StackDepth</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">UBaseType_t&#160;</td>
          <td class="paramname"><em>Priority</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p >Constructor to create a named thread.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">Name</td><td>Name of the thread. Only useful for debugging. </td></tr>
    <tr><td class="paramname">StackDepth</td><td>Number of "words" allocated for the <a class="el" href="classcpp__freertos_1_1_thread.html">Thread</a> stack. </td></tr>
    <tr><td class="paramname">Priority</td><td>FreeRTOS priority of this <a class="el" href="classcpp__freertos_1_1_thread.html">Thread</a>. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a12f645310d73fb7fb31dfc4e0b971e1b" name="a12f645310d73fb7fb31dfc4e0b971e1b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a12f645310d73fb7fb31dfc4e0b971e1b">&#9670;&#160;</a></span>Thread() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Thread::Thread </td>
          <td>(</td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>StackDepth</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">UBaseType_t&#160;</td>
          <td class="paramname"><em>Priority</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p >Constructor to create an unnamed thread.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">StackDepth</td><td>Number of "words" allocated for the <a class="el" href="classcpp__freertos_1_1_thread.html">Thread</a> stack. </td></tr>
    <tr><td class="paramname">Priority</td><td>FreeRTOS priority of this <a class="el" href="classcpp__freertos_1_1_thread.html">Thread</a>. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a37d9edd3a1a776cbc27dedff949c9726" name="a37d9edd3a1a776cbc27dedff949c9726"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a37d9edd3a1a776cbc27dedff949c9726">&#9670;&#160;</a></span>~Thread()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">Thread::~Thread </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p >Our destructor. This must exist even if FreeRTOS is configured to disallow task deletion. </p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a997f36c77c28021873241b0df1c21a6b" name="a997f36c77c28021873241b0df1c21a6b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a997f36c77c28021873241b0df1c21a6b">&#9670;&#160;</a></span>Cleanup()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void Thread::Cleanup </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p >Called on exit from your <a class="el" href="classcpp__freertos_1_1_thread.html#a93df31e4bee72f150dd742ab5d6d35c3">Run()</a> routine.</p>
<p >It is optional whether you implement this or not.</p>
<p >If you allow your <a class="el" href="classcpp__freertos_1_1_thread.html">Thread</a> to exit its Run method, implementing a Cleanup method allows you to call your <a class="el" href="classcpp__freertos_1_1_thread.html">Thread</a>'s destructor. If you decide to call delete in your Cleanup function, be aware that additional derived classes shouldn't call delete. </p>

</div>
</div>
<a id="a654a6f8af37d09ede473728dd76acffe" name="a654a6f8af37d09ede473728dd76acffe"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a654a6f8af37d09ede473728dd76acffe">&#9670;&#160;</a></span>Delay()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void cpp_freertos::Thread::Delay </td>
          <td>(</td>
          <td class="paramtype">const TickType_t&#160;</td>
          <td class="paramname"><em>Delay</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">protected</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p >If we can't delete a task, it makes no sense to have a Cleanup routine. Delay this thread for at least Delay ticks.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">Delay</td><td>How long to delay the thread. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a9fb9580f5d710d6c9b1c4e8a8d23985c" name="a9fb9580f5d710d6c9b1c4e8a8d23985c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9fb9580f5d710d6c9b1c4e8a8d23985c">&#9670;&#160;</a></span>DelayUntil()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void Thread::DelayUntil </td>
          <td>(</td>
          <td class="paramtype">const TickType_t&#160;</td>
          <td class="paramname"><em>Period</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p >Delay this thread for Period ticks, taking into account the execution time of the thread.</p>
<p >This FreeRTOS permutation of delay can be used by periodic tasks to ensure a constant execution frequency.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">Period</td><td>How long to delay the thread. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ae594e304335470c5dec7933643e66418" name="ae594e304335470c5dec7933643e66418"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae594e304335470c5dec7933643e66418">&#9670;&#160;</a></span>EndScheduler()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void cpp_freertos::Thread::EndScheduler </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p >End the scheduler.</p>
<dl class="section note"><dt>Note</dt><dd>Please see the FreeRTOS documentation regarding constraints with the implementation of this.</dd>
<dd>
You need to use this call. Do NOT directly call vTaskEndScheduler while using this library. </dd></dl>

</div>
</div>
<a id="a1053a1c4f291a9a9a5dbf4ead7e96ae7" name="a1053a1c4f291a9a9a5dbf4ead7e96ae7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1053a1c4f291a9a9a5dbf4ead7e96ae7">&#9670;&#160;</a></span>GetHandle()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">TaskHandle_t cpp_freertos::Thread::GetHandle </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p >Accessor to get the thread's backing task handle. There is no setter, on purpose.</p>
<dl class="section return"><dt>Returns</dt><dd>FreeRTOS task handle. </dd></dl>

</div>
</div>
<a id="a51469110641ad7ba19a32364dd18c213" name="a51469110641ad7ba19a32364dd18c213"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a51469110641ad7ba19a32364dd18c213">&#9670;&#160;</a></span>GetName()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::string cpp_freertos::Thread::GetName </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p >Get the name of this thread.</p>
<dl class="section return"><dt>Returns</dt><dd>a C++ string with the name of the task. </dd></dl>

</div>
</div>
<a id="ace92214a082dd8fd49e48af680e9bee5" name="ace92214a082dd8fd49e48af680e9bee5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ace92214a082dd8fd49e48af680e9bee5">&#9670;&#160;</a></span>GetPriority()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">UBaseType_t cpp_freertos::Thread::GetPriority </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p >Get the priority of this <a class="el" href="classcpp__freertos_1_1_thread.html">Thread</a>.</p>
<dl class="section return"><dt>Returns</dt><dd>Priority at the time this was called. </dd></dl>

</div>
</div>
<a id="a00923e979ba8b757d293c7f33701df29" name="a00923e979ba8b757d293c7f33701df29"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a00923e979ba8b757d293c7f33701df29">&#9670;&#160;</a></span>GetPriorityFromISR()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">UBaseType_t cpp_freertos::Thread::GetPriorityFromISR </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p >Get the priority of this <a class="el" href="classcpp__freertos_1_1_thread.html">Thread</a> from ISR context.</p>
<dl class="section return"><dt>Returns</dt><dd>Priority at the time this was called. </dd></dl>

</div>
</div>
<a id="a71f796ec7c2bd53bb0f28b648967f601" name="a71f796ec7c2bd53bb0f28b648967f601"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a71f796ec7c2bd53bb0f28b648967f601">&#9670;&#160;</a></span>ResetDelayUntil()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void Thread::ResetDelayUntil </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p >If you need to adjust or reset the period of the DelayUntil method. </p>

</div>
</div>
<a id="a0a413b18b2818072998320f1f6388eee" name="a0a413b18b2818072998320f1f6388eee"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0a413b18b2818072998320f1f6388eee">&#9670;&#160;</a></span>Resume()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void cpp_freertos::Thread::Resume </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p >Resume a specific thread. </p>

</div>
</div>
<a id="aa11e945ef24eb35b4df261050576a2c0" name="aa11e945ef24eb35b4df261050576a2c0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa11e945ef24eb35b4df261050576a2c0">&#9670;&#160;</a></span>ResumeFromISR()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void cpp_freertos::Thread::ResumeFromISR </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p >Resume a specific thread from ISR context. </p>

</div>
</div>
<a id="a93df31e4bee72f150dd742ab5d6d35c3" name="a93df31e4bee72f150dd742ab5d6d35c3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a93df31e4bee72f150dd742ab5d6d35c3">&#9670;&#160;</a></span>Run()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void cpp_freertos::Thread::Run </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p >Implementation of your actual thread code. You must override this function. </p><dl class="section note"><dt>Note</dt><dd>If INCLUDE_vTaskDelete is defined, then you may return from your Run method. This will cause the task to be deleted from FreeRTOS, however you are still responsible to delete the task object. If this is not defined, then retuning from your <a class="el" href="classcpp__freertos_1_1_thread.html#a93df31e4bee72f150dd742ab5d6d35c3">Run()</a> method will result in an assert. </dd></dl>

<p>Implemented in <a class="el" href="classcpp__freertos_1_1_task.html#a94e152a6479143e1f56627dee9f4df8a">cpp_freertos::Task</a>.</p>

</div>
</div>
<a id="a5e40076f0050bdcfcf949506f139879e" name="a5e40076f0050bdcfcf949506f139879e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5e40076f0050bdcfcf949506f139879e">&#9670;&#160;</a></span>SetPriority()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void cpp_freertos::Thread::SetPriority </td>
          <td>(</td>
          <td class="paramtype">UBaseType_t&#160;</td>
          <td class="paramname"><em>NewPriority</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p >Set the priority of this thread.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">NewPriority</td><td>The thread's new priority. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a279c2b78aa2bf43371f2462623588830" name="a279c2b78aa2bf43371f2462623588830"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a279c2b78aa2bf43371f2462623588830">&#9670;&#160;</a></span>Start() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Thread::Start </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p >Starts a thread.</p>
<p >This is the API call that actually starts the thread running. It creates a backing FreeRTOS task. By separating object creation from starting the <a class="el" href="classcpp__freertos_1_1_thread.html">Thread</a>, it solves the pure virtual fuction call failure case. If we attempt to automatically call xTaskCreate from the base class constructor, in certain conditions the task starts to run "before" the derived class is constructed! So we don't do that anymore.</p>
<p >This may be called from your ctor once you have completed your objects construction (so as the last step).</p>
<p >This should only be called once ever! </p>

</div>
</div>
<a id="ad316472f4b620715ea0afe15f157d88d" name="ad316472f4b620715ea0afe15f157d88d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad316472f4b620715ea0afe15f157d88d">&#9670;&#160;</a></span>Start() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Thread::Start </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>core</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Starts the task on the indicated core. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">core</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if it could be started successfully </dd></dl>

</div>
</div>
<a id="a6c5e2fea2e1badb606730c279559aa36" name="a6c5e2fea2e1badb606730c279559aa36"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6c5e2fea2e1badb606730c279559aa36">&#9670;&#160;</a></span>StartScheduler()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void cpp_freertos::Thread::StartScheduler </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p >Start the scheduler.</p>
<dl class="section note"><dt>Note</dt><dd>You need to use this call. Do NOT directly call vTaskStartScheduler while using this library. </dd></dl>

</div>
</div>
<a id="a9eca55dec69e4758cf397e882338c7e6" name="a9eca55dec69e4758cf397e882338c7e6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9eca55dec69e4758cf397e882338c7e6">&#9670;&#160;</a></span>Suspend()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void cpp_freertos::Thread::Suspend </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p >Suspend this thread.</p>
<dl class="section note"><dt>Note</dt><dd>While a <a class="el" href="classcpp__freertos_1_1_thread.html">Thread</a> can <a class="el" href="classcpp__freertos_1_1_thread.html#a9eca55dec69e4758cf397e882338c7e6">Suspend()</a> itself, it cannot <a class="el" href="classcpp__freertos_1_1_thread.html#a0a413b18b2818072998320f1f6388eee">Resume()</a> itself, becauseit's suspended. </dd></dl>

</div>
</div>
<a id="a91a73909fb17ee160f992a78cfd2b119" name="a91a73909fb17ee160f992a78cfd2b119"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a91a73909fb17ee160f992a78cfd2b119">&#9670;&#160;</a></span>Wait()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool Thread::Wait </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classcpp__freertos_1_1_condition_variable.html">ConditionVariable</a> &amp;&#160;</td>
          <td class="paramname"><em>Cv</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classcpp__freertos_1_1_mutex.html">Mutex</a> &amp;&#160;</td>
          <td class="paramname"><em>CvLock</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">TickType_t&#160;</td>
          <td class="paramname"><em>Timeout</em> = <code>portMAX_DELAY</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p >Have this thread wait on a condition variable.</p>
<dl class="section note"><dt>Note</dt><dd>Threads wait, while ConditionVariables signal.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">Cv</td><td>The condition variable associated with the Wait. </td></tr>
    <tr><td class="paramname">CvLock</td><td>The required condition variable lock. The Lock must be held before calling Wait. </td></tr>
    <tr><td class="paramname">Timeout</td><td>Allows you to specify a timeout on the Wait, if desired.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if the condition variable was signaled, false if it timed out. </dd></dl>

</div>
</div>
<a id="abe20a08801d022da203e0295dbb59cbb" name="abe20a08801d022da203e0295dbb59cbb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abe20a08801d022da203e0295dbb59cbb">&#9670;&#160;</a></span>Yield()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void cpp_freertos::Thread::Yield </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p >Yield the scheduler. </p>

</div>
</div>
<h2 class="groupheader">Friends And Related Function Documentation</h2>
<a id="ab270e49e575fdf0fe1a4f2ee911df116" name="ab270e49e575fdf0fe1a4f2ee911df116"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab270e49e575fdf0fe1a4f2ee911df116">&#9670;&#160;</a></span>ConditionVariable</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">friend class <a class="el" href="classcpp__freertos_1_1_condition_variable.html">ConditionVariable</a></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">friend</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p >The <a class="el" href="classcpp__freertos_1_1_thread.html">Thread</a> class and the <a class="el" href="classcpp__freertos_1_1_condition_variable.html">ConditionVariable</a> class are interdependent. If we allow the <a class="el" href="classcpp__freertos_1_1_condition_variable.html">ConditionVariable</a> class to access the internals of the <a class="el" href="classcpp__freertos_1_1_thread.html">Thread</a> class, we can reduce the public interface, which is a good thing. </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>src/<a class="el" href="thread_8hpp_source.html">thread.hpp</a></li>
<li>src/freertos-addon/c++/cthread.cpp</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.5
</small></address>
</body>
</html>
